#!/bin/sh
SRCDIR=u-boot-2010.09

create_cscope()
{
    DIR=$(pwd)
    #echo "dir:" $DIR
    WORKDIR=$DIR/$SRCDIR
    CSCOPEFILE=$DIR/cscope.files
    echo "this src dir is: " $WORKDIR "  cscope file: " $CSCOPEFILE
    cd /    
    find  $WORKDIR                                                                \
        -path "$WORKDIR/arch/arm/cpu/arm920t/*" \
                        ! -path "$WORKDIR/arch/arm/cpu/arm920t/cpu.c"           \
                        ! -path "$WORKDIR/arch/arm/cpu/arm920t/interrupts.c"    \
                        ! -path "$WORKDIR/arch/arm/cpu/arm920t/Start.S"         \
                        ! -path "$WORKDIR/arch/arm/cpu/arm920t/s3c24x0*"       \
                                                      -prune -o               \
        -path "$WORKDIR/arch/arm/include/asm/*" \
                        ! -path "$WORKDIR/arch/arm/include/asm/arch-s3c24x0/*"  \
                        ! -path "$WORKDIR/arch/arm/include/asm/proc-armv/*"     \
                        ! -path "$WORKDIR/arch/arm/include/asm/atomic.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/bitops.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/byteorder.h"     \
                        ! -path "$WORKDIR/arch/arm/include/asm/cache.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/config.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/dma-mapping.h"   \
                        ! -path "$WORKDIR/arch/arm/include/asm/errno.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/global_data.h"   \
                        ! -path "$WORKDIR/arch/arm/include/asm/hardware.h"      \
                        ! -path "$WORKDIR/arch/arm/include/asm/io.h"            \
                        ! -path "$WORKDIR/arch/arm/include/asm/mach-types.h"    \
                        ! -path "$WORKDIR/arch/arm/include/asm/macro.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/memory.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/posix_types.h"   \
                        ! -path "$WORKDIR/arch/arm/include/asm/processor.h"     \
                        ! -path "$WORKDIR/arch/arm/include/asm/ptrace.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/setup.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/sizes.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/string.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/system.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/types.h"         \
                        ! -path "$WORKDIR/arch/arm/include/asm/u-boot-arm.h"    \
                        ! -path "$WORKDIR/arch/arm/include/asm/u-boot.h"        \
                        ! -path "$WORKDIR/arch/arm/include/asm/unaligned.h"     \
                                                      -prune -o               \
        -path "$WORKDIR/arch/arm/cpu/lib/*" \
                        ! -path "$WORKDIR/arch/arm/cpu/lib*"                       \
                                                      -prune -o               \
        -path "$WORKDIR/include/configs/*" ! -path "$WORKDIR/include/configs/qq2440.h" -prune -o \
        -path "$WORKDIR/api*" -prune -o                                           \
        -path "$WORKDIR/doc*" -prune -o                                           \
        -path "$WORKDIR/examples*" -prune -o                                      \
        -path "$WORKDIR/tools*" -prune -o                                      \
        -path "$WORKDIR/tmp*" -prune -o                                           \
        -name "*.[chxsS]" -print > $CSCOPEFILE
    echo "debug : " "$WORKDIR/include/configs*"
    echo "create :" $CSCOPEFILE
}


create_tags()
{
    echo "ctags file ..."
    ctags -R 
}



#main entry
create_cscope
cd $DIR
create_tags
cscope -b -q -k
